package com.tw.customization;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class CustomizationScreen implements Screen {

	int w = Gdx.graphics.getWidth();
	int h = Gdx.graphics.getHeight();
	int bodyw = (int)(w / 1.5);
	int bodyh = (int)(h / 1.5);
	private SpriteBatch batch;

	int bodyindex = 0;
	private String bodies[] = new String[6];
	private Sprite bodysprs[] = new Sprite[6];
	
	boolean wait = false;
	
	public CustomizationScreen()
	{
		bodies[0] = "data/boycharbeige.png" ;
		bodies[1] = "data/boychartan.png" ;
		bodies[2] = "data/boychardark.png" ;
		bodies[3] = "data/girlcharbeige.png" ;
		bodies[4] = "data/girlchartan.png" ;
		bodies[5] = "data/girlchardark.png" ;
		
		for(int i = 0 ; i < 6; i++)
		{
			bodysprs[i] = new Sprite(new Texture(bodies[i]));
			bodysprs[i].setBounds((float) (0 + 5), (float)(0 + 5), w * 0.5f,  h -10 );
		}
		batch = new SpriteBatch();
	}
	
	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		batch.begin();
		bodysprs[bodyindex].draw(batch);
		batch.end(); 
		update(delta);
	}
	
	public void update(float delta) {
		if(Gdx.input.isTouched() && !wait)
		{
			bodyindex = (bodyindex + 1) % 6;
			wait = true;
		}
		if(!Gdx.input.isTouched()) wait = false;
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}
	
}
